package com.wms.mapper;

import com.wms.dto.*;
import com.wms.entity.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

@Mapper
public interface StockInMapper {

    List<ProcessIn> getProcessInTask(ProcessIn process);
    List<ProcessInDetail> getProcessInDetail(ProcessInDetailDTO process);
    Integer getMaxProcessInTaskId();
    int saveProcessInTask(ProcessIn process);
    int saveProcessInDetail(List<ProcessInDetail> list);
    List<PurchaseStockIn> getPurchaseStockInTask(PurchaseStockIn stock);
    List<PurchaseDetailDTO> getPurchaseStockInDetail(PurchaseDetailDTO stock);
    //当arrivalNum质检后的到货量和已入库量inNum相等时将status设为3(全部入库)
    int updateStockInSuccess();
    int updateStockDetail(@Param("stock") int stock,@Param("productCode") String productCode);
    int removeStockDetail(int id);
    List<Map<String,Object>> getDirectInTask(DirectInDTO direct);
    List<Map<String,Object>> getPQInTask();

    MasDTO queryMASStock(MasDTO dto);
    int updateMASStock(MasDTO dto);

    int saveMAS(MasDTO dto);
    List<Map<String,Object>> getDirectInDetail(DirectInDetailDTO direct);
    //添加直接入库任务单,同时生成批次号
    int saveDirectInTask(DirectIn direct);
    //批量插入直接入库任务详情;一批次多任务
    int saveDirectInTaskDetail(List<DirectInDetail> list);
    //查询直接入库最大任务单id
    Integer getMaxDirectInTaskId();
    //查询最大直接入库任务单编码
    String getMaxDirectInTaskCode();
    //查询最大加工入库任务编码
    String getMaxProcessInTaskCode();
    String getMaxDirectBatchNum();
    String getMaxProcessBatchNum();
    int saveBatchNum(List<BatchNum> list);
    int updateBatchNum(@Param("batchNo") String batchNo, @Param("mid") int mid, @Param("inTime") String inTime);

    //添加入库记录
    int saveStockInRecord(StockInRecord record);
    StockInRecord getRecodeNeeds(Integer did);
    List<StockInRecord> getStockRecord(RecordDTO record);
    //获取当前最大采购入库任务单id
    Integer getMaxPurchaseInTaskId();
    //获取当前最大采购入库任务编码
    String getMaxPurchaseInTaskCode();
    //获取当前最大调拨入库任务编码
    String getMaxDBInTaskCode();
    //向采购任务表插入任务
    int savePurchaseInTask(PurchaseStockIn task);
    //向采购任务详情表插入任务(批量)
    int savePurchaseInDetailTask(List<PurchaseStockInDetail> details);
}
